FROM java:8

ENV DJ_SLEEP 0
ENV PROFILE dev
ARG JAR_FILE

# add directly the war
ADD ${JAR_FILE} /code.war

RUN sh -c 'touch /code.war'
VOLUME /tmp
EXPOSE 8887
CMD echo "The application will start in ${DJ_SLEEP}s..." && \
    sleep ${DJ_SLEEP} && \
    java -jar -Ddefault.client.encoding="UTF-8" -Dfile.encoding="UTF-8" -Duser.language="Zh" -Duser.region="CN" code.war --spring.profiles.active=${PROFILE}
